<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	 
	public function Welcome(){
	    parent::__construct(); 
        
        $this->load->model('publicar/avisos_model');
	}
    
	public function index()
	{
	    
         if($this->session->userdata("logged_in")){
            $this->inicio();
             return;
         }
        
	    //seta os parametros da view, e da barra de menu
	    $view = array(
	       'main_view' => 'tela_inicial',
	       'main_view_data' => "",
	       'title' => 'Inicio',
	       'menu' => array(
	           'navbar' => 'menu/navbar_externa',
	           'active_menu_item' => 'inicio'
           )
	       
        ); 
        
		$this->load->view('template/template',$view);
	}
    
    public function sobre(){
        if($this->session->userdata("logged_in"))
            $navbar = 'menu/navbar_interna';
        else 
            $navbar = 'menu/navbar_externa';
            
        $view = array(
           'main_view' => 'sobre',
           'main_view_data' => "",
           'title' => 'Sobre',
           'menu' => array(
               'navbar' => $navbar,
               'active_menu_item' => 'sobre'
           )
           
        ); 
        
        $this->load->view('template/template',$view);
    }

	public function inicio(){
	    
        $avisos = $this->avisos_model->get_todos_avisos();
        $atividades = $this->avisos_model->get_atividades();
        $main_data_view = array(
            'avisos' => $avisos,
            'atividades' => $atividades
        );
        
		$view = array(
           'main_view' => 'inicio',
           'main_view_data' => $main_data_view,
           'title' => 'Inicio',
           'menu' => array(
               'navbar' => 'menu/navbar_interna',
               'active_menu_item' => 'inicio'
           )
           
        ); 
		$this->load->view('template/template',$view);
	}

    
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */